package com.lvyou.service;

import com.lvyou.entity.GoodsModel;
import com.lvyou.mapper.IGoodsMapper;
import com.lvyou.model.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class GoodsSrvImpl {
    @Resource
    private IGoodsMapper dao;
    //不要使用select
    public List<GoodsModel> query() {
        List<GoodsModel> list = dao.query();
        return list;
    }

    public int save(GoodsModel gm) {
        String uuid = UUID.randomUUID().toString().replace("-", "");
        gm.setId(uuid);
        gm.setName(gm.getName());
        Date date = new Date();
        gm.setCreateTime(date);
        gm.setUpdateTime(date);
//        int i = dao.save(gm);
        return 1;
    }
}
